package com.example.app.model;

import com.example.app.model.common.CommonModel;
import lombok.Data;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Transient;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by wangtao on 2018/1/26.
 */
@Entity(name = "sys_organ")
@Data
public class Organ extends CommonModel {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    // 组织机构代码
    @Column(name = "organ_code")
    private String organCode;
    // 组织机构名称
    @Column(name = "organ_name")
    private String organName;
    // 组织机构父节点
    @Column(name = "parent_id")
    private Long parentId;
    // 图标
    @Column(name = "icon")
    private String icon;
    // 级别
    @Column(name = "level")
    private int level;
    // 排序
    @Column(name = "sort")
    private int sort;
    // 是否选中
    @Transient
    private boolean checked = false;
    // 子菜单集合
    @Transient
    private List<Organ> children = new ArrayList<Organ>();
    // 账户编号
    @Column(name = "account_id")
    private Long accountId;
}
